// ---------------------------------------------------------------------
//
// -- 存档信息
// -- author £
//
// ---------------------------------------------------------------------

const saveDataKey = 'HexagonDFTTSaveData';

let SaveData = {
    data: null,
    
    /** 启动 */
    startup: function () {
        let str = cc.sys.localStorage.getItem(saveDataKey);

        if (str) {
            this.data = JSON.parse(str);
        }
        console.log('get save data:', this.data);
    },

    save: function (sd) {
        this.data = sd;
        cc.sys.localStorage.setItem(saveDataKey, JSON.stringify(sd));
    },

    clear: function () {
        this.data = null;
        cc.sys.localStorage.removeItem(saveDataKey);
    },

};

module.exports = SaveData;